<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<style>
  a{
    text-decoration: none;
  }
  #title{
    margin: auto;
  }
</style>
<body>
  <a id="changehref">
  <h1 id="title" ></h1>
  </a>
</body>
<script>
  window.onload=function(){
    var title=document.getElementById("title");
    var changehref=document.getElementById("changehref");
    var arr=["百度公司","阿里巴巴","腾讯","新浪微博"];
    var Hrefarr=["https://www.baidu.com/","https://www.1688.com/","https://www.qq.com/","https://www.weibo.com/"];
    var i=0;
      setInterval(()=>{
        
        title.innerHTML=arr[i];
        changehref.href=Hrefarr[i];
        i++;
        if(i>=4){
          i=0;
        }
      },2000);
    
  }
</script>
</html>